<?php
/**
 * Created by PhpStorm.
 * User: khanhht
 * Date: 7/16/14
 * Time: 11:30 AM
 */

class My_Service_Cluster extends My_Service_Abstract {


    public function __construct(){
        parent::__construct();
        $this->_model = new Default_Model_Cluster();
    }

    /**
     * get cluster of game
     * @param $gameId
     * @param null $username
     * @param null $type
     * @param null $channelId
     * @return array|mixed
     */

    public function getClusterGame($gameId, $username = null,$type = null, $channelId = null){
        $key = sprintf($this->_cache_key,md5(__CLASS__ . __FUNCTION__ . json_encode(func_get_args())));
        $result = $this->_memcache->get($key);
        if(!$result){
            $result = $this->_model->getClusterGame($gameId, $username,$type)->toArray();
            if($result){
                $this->_memcache->set($key,$result,false,0);
            }
        }
        return $result;
    }

} 